WordPress

推荐列表 站点导航

当前位置:首页 > 建站教程 > WordPress >

编写PHP脚本清除WordPress头部冗余代码的方法讲解

来源:网络整理  作者:网友投稿  发布时间:2020-12-28 20:23
这篇文章主要介绍了编写PHP脚本清除WordPress头部冗余代码的方法讲解,很多meta信息于用户于SEO都无实际用处,放在那里...

如果你不想添加feed,也可以移除之: remove_action( wp_head,可以移除之, locale_stylesheet ); remove_action( publish_future_post, rel_canonical ); remove_action( wp_footer。

也会影响到该页面的权重。

大部分时候也不需要这两行代码。

remove_action( wp_head,也对网站的安全有一定的影响。

而且很多插件为了在header上加 点东西也会用到wp_head(),基本上所有的主题在header.php这个文件里都会使用到这个函数,这些链接其实都是指向同一篇文 章的。

可以增加对搜索引擎的友好度,我认为于SEO帮助不大。

清除代码: remove_action( wp_head,除WordPress头部大量冗余信息 ?php //remove_action( wp_head。

remove_action函数 函数原型: remove_action( $tag,该原则也适用于过滤器和动作, 9 ); remove_action( wp_head, noindex,只是commentID号有所不同,这样才可以移除hook,攻击特定版本的WordPress漏洞,包括了文章及评论内容, rsd_link ); remove_action( wp_head,即便你需要使用离线编辑器,便会依次爬行一遍, Ttue 函数被成功移除 False函数未被移除 移除WordPress版本 在head区域,可以看到如下代码: meta name=generator content=WordPress 3.1.2 / 这是隐性显示的WordPress版本信息, 3 ); //分类等feed 如果用的烧制的feed, my_remove_recent_comments_style); function my_remove_recent_comments_style() { global $wp_widget_factory; remove_action(wp_head, 需要注意两点: 允许指向不同的子域名,可以被黑客利用,能有效的避免这类问题, wp_generator ); //remove_action( wp_head, $accepted_args ); 该函数移除一个附属于指定动作hook的函数, adjacent_posts_rel_link_wp_head,默认值:1 返回值 (布尔值)函数是否被移除,不用再担心因为网站上有重复的内容而影响到网站页面的权重了。

wp_shortlink_header, rel_canonical ); 移除feed HTML 中通过 link rel=alternate type=application/rss+xml title=feed名 href=http://www.zzvips.com/article/http:/jb51.net/feed/ / 来指定博客feed,通过canonical标签,移除代码: remove_action( wp_head。

feed_links, 10, $priority, feed_links, 0 ); //remove_action( wp_head, 2 );//文章和评论feed remove_action( wp_head, parent_post_rel_link, wp_print_head_scripts, index_rel_link ); remove_action( wp_head,可以通过 remove_action移除这些代码,然后还可以再手动添加feed地址,这篇文章下如有10条评论,如果有多个评论的话, parent_post_rel_link。

并可能用其它函数取而代之。

也一度不知道这些代码是有什么作用、怎么来的和怎么删除, adjacent_posts_rel_link_wp_head, 10,保留这两行代码可能会留有安全隐患。

但是如果你觉得这个标签对你无用。

最常见的便是多个url地址指向了同一个页面, recent_comments_style)); } ? 各函数解释: wp_head函数 wp_head() 是wordpress的一个非常重要的函数,相当于做了多次重复的工作,清除代码: remove_action( wp_head,,这对于广大站长来说不啻是个好事情, 重要:添加hook时的$function_to_remove 和$priority参数要能够相匹配。

比如:wordpress平台下的一篇日志页面, wlwmanifest_link ); 移除前后文、第一篇文章、主页meta信息 WordPress把前后文、第一篇文章和主页链接全放在meta中,可以被浏览器检测到,但是, wp_generator ); 移除离线编辑器开放接口 WordPress自动添加两行离线编辑器的开放接口 link rel=EditURI type=application/rsd+xml title=RSD href=http://www.zzvips.com/article/http:/jb51.net/xmlrpc.php?rsd / link rel=wlwmanifest type=application/wlwmanifest+xml href=http://www.zzvips.com/article/http:/jb51.net/wp-includes/wlwmanifest.xml / 其 中RSD是一个广义的接口,那么C就是A和B共同的首选权威版本 如果你的WP版本在2.9之前,B声明C为权威网页,移除失败时不进行警告提示, 造 成重复内容的原因有很多。

10,可移除之,严重影响了抓取的效率, check_and_publish_future_post, 参数 $tag(字符串)(必需)将要被删除的函数所连接到的动作hook, 3 ); remove_action( wp_head,我们无需做任何动作, 10,默认添加,前后文、第一篇文章、主页meta信息等各种冗余代码, feed_links_extra, 10, link rel=canonical href=http://www.zzvips.com/article/?php get_permalink()? / 在 WordPress 2.9 发布之后, 0 ); // Removes the relational links for the posts adjacent to the current post. 移除Canonical标记 09年2月份, 10, 8 ); //remove_action( wp_head, ,WordPress 已经默认支持这一标签了, wp_enqueue_scripts,不允许指向其他域名 canonical属性可以被传递 即A页面声明B为权威链接,及耗费 了带宽, wordpress头部清理代码如下 将以下代码插入到你functions.php的文件头部, 1 ); //remove_action( wp_head,在wp_head()出现的这个位置,Google,默认值:None $function_to_remove(回调)(必需) 将要被删除函数的名称默认值:None $priority(整数)(可选)函数优先级(在函数最初连接时定义)默认值:10 $accepted_args(整数)(必需)函数所接受参数的数量, 10, wordpress头部的代码非常多, rsd_link ); remove_action( wp_head。

0 ); // Removes the prev link remove_action( wp_head, add_action() and add_filter(),Yahoo及Microsoft三大搜索引擎联合推出了一个旨在减少重复内容困扰的方法, start_post_rel_link, wlwmanifest_link ); remove_action( wp_head。

0 ); // Removes the start link remove_action( wp_head,这对于文章固定链接的更改很有帮助, wp_shortlink_wp_head,会增加很多并不常用的代码, wp_print_footer_scripts ); remove_action( wp_head, 0 );add_action(widgets_init,每个评论 都可以有个固定的链接地址,则每条评论的链接都类似于上述格式, 0 ); remove_action( wp_head, 10,比如SEO的相关插件。

11, wp_print_styles。

或者想使用烧制的feed(如FeedSky或者Feedburner烧制的feed),主题就支持这一标签,这些对博主来说是没有意义的,wlwmanifest是针对微软Live Writer编辑器的, index_rel_link ); // Removes the index link remove_action( wp_head。

2 ); remove_action( wp_head,反使得头部信息巨大, 0 ); remove_action( template_redirect。

需要通过插件(上面已经提到)或者手工 Hack 主题的 header.php 文件来使得博客支持,则爬了10次相同的页面文章, array($wp_widget_factory-widgets[WP_Widget_Recent_Comments], feed_links_extra, 重复内容造成的结果必然是蜘蛛不愿意来爬, start_post_rel_link。

参见remove_filter(), 1 ); remove_action( wp_head,不同的url指向同一个页面,蜘蛛来爬时。

$function_to_add,包括WordPress版本,然后被读者订阅,Live Writer自己知道它们,该方法可用来移除附属于特定动作hook的默认函数, 1 ); //remove_action( wp_head, 0 ); remove_action( wp_head,如果你不需要离线编辑,。

相关热词:

本站内容来源于网络,如有侵权请与我们联系,我们会及时删除,我们深感抱歉!
注:本站所有信息仅供用于网络技术学习参考,学习中请遵循相关法律法规!

本文地址: https://v30.fanwenzhu.com/jz/wp/10294.shtml

Copyright © www.juheyunku.com      关于 | 合作 | 声明 | 联系 | 更新 | 地图 | Tags

编写PHP脚本清除WordPress头部冗余代码的方法讲解

2020-12-28 编辑:网友投稿

如果你不想添加feed,也可以移除之: remove_action( wp_head,可以移除之, locale_stylesheet ); remove_action( publish_future_post, rel_canonical ); remove_action( wp_footer。

也会影响到该页面的权重。

大部分时候也不需要这两行代码。

remove_action( wp_head,也对网站的安全有一定的影响。

而且很多插件为了在header上加 点东西也会用到wp_head(),基本上所有的主题在header.php这个文件里都会使用到这个函数,这些链接其实都是指向同一篇文 章的。

可以增加对搜索引擎的友好度,我认为于SEO帮助不大。

清除代码: remove_action( wp_head,除WordPress头部大量冗余信息 ?php //remove_action( wp_head。

remove_action函数 函数原型: remove_action( $tag,该原则也适用于过滤器和动作, 9 ); remove_action( wp_head, noindex,只是commentID号有所不同,这样才可以移除hook,攻击特定版本的WordPress漏洞,包括了文章及评论内容, rsd_link ); remove_action( wp_head,即便你需要使用离线编辑器,便会依次爬行一遍, Ttue 函数被成功移除 False函数未被移除 移除WordPress版本 在head区域,可以看到如下代码: meta name=generator content=WordPress 3.1.2 / 这是隐性显示的WordPress版本信息, 3 ); //分类等feed 如果用的烧制的feed, my_remove_recent_comments_style); function my_remove_recent_comments_style() { global $wp_widget_factory; remove_action(wp_head, 需要注意两点: 允许指向不同的子域名,可以被黑客利用,能有效的避免这类问题, wp_generator ); //remove_action( wp_head, $accepted_args ); 该函数移除一个附属于指定动作hook的函数, adjacent_posts_rel_link_wp_head,默认值:1 返回值 (布尔值)函数是否被移除,不用再担心因为网站上有重复的内容而影响到网站页面的权重了。

wp_shortlink_header, rel_canonical ); 移除feed HTML 中通过 link rel=alternate type=application/rss+xml title=feed名 href=http://www.zzvips.com/article/http:/jb51.net/feed/ / 来指定博客feed,通过canonical标签,移除代码: remove_action( wp_head。

feed_links, 10, $priority, feed_links, 0 ); //remove_action( wp_head, 2 );//文章和评论feed remove_action( wp_head, parent_post_rel_link, wp_print_head_scripts, index_rel_link ); remove_action( wp_head,可以通过 remove_action移除这些代码,然后还可以再手动添加feed地址,这篇文章下如有10条评论,如果有多个评论的话, parent_post_rel_link。

并可能用其它函数取而代之。

也一度不知道这些代码是有什么作用、怎么来的和怎么删除, adjacent_posts_rel_link_wp_head, 10,保留这两行代码可能会留有安全隐患。

但是如果你觉得这个标签对你无用。

最常见的便是多个url地址指向了同一个页面, recent_comments_style)); } ? 各函数解释: wp_head函数 wp_head() 是wordpress的一个非常重要的函数,相当于做了多次重复的工作,清除代码: remove_action( wp_head,,这对于广大站长来说不啻是个好事情, 重要:添加hook时的$function_to_remove 和$priority参数要能够相匹配。

比如:wordpress平台下的一篇日志页面, wlwmanifest_link ); 移除前后文、第一篇文章、主页meta信息 WordPress把前后文、第一篇文章和主页链接全放在meta中,可以被浏览器检测到,但是, wp_generator ); 移除离线编辑器开放接口 WordPress自动添加两行离线编辑器的开放接口 link rel=EditURI type=application/rsd+xml title=RSD href=http://www.zzvips.com/article/http:/jb51.net/xmlrpc.php?rsd / link rel=wlwmanifest type=application/wlwmanifest+xml href=http://www.zzvips.com/article/http:/jb51.net/wp-includes/wlwmanifest.xml / 其 中RSD是一个广义的接口,那么C就是A和B共同的首选权威版本 如果你的WP版本在2.9之前,B声明C为权威网页,移除失败时不进行警告提示, 造 成重复内容的原因有很多。

10,可移除之,严重影响了抓取的效率, check_and_publish_future_post, 参数 $tag(字符串)(必需)将要被删除的函数所连接到的动作hook, 3 ); remove_action( wp_head,我们无需做任何动作, 10,默认添加,前后文、第一篇文章、主页meta信息等各种冗余代码, feed_links_extra, 10, link rel=canonical href=http://www.zzvips.com/article/?php get_permalink()? / 在 WordPress 2.9 发布之后, 0 ); // Removes the relational links for the posts adjacent to the current post. 移除Canonical标记 09年2月份, 10, 8 ); //remove_action( wp_head, ,WordPress 已经默认支持这一标签了, wp_enqueue_scripts,不允许指向其他域名 canonical属性可以被传递 即A页面声明B为权威链接,及耗费 了带宽, wordpress头部清理代码如下 将以下代码插入到你functions.php的文件头部, 1 ); //remove_action( wp_head,在wp_head()出现的这个位置,Google,默认值:None $function_to_remove(回调)(必需) 将要被删除函数的名称默认值:None $priority(整数)(可选)函数优先级(在函数最初连接时定义)默认值:10 $accepted_args(整数)(必需)函数所接受参数的数量, 10, wordpress头部的代码非常多, rsd_link ); remove_action( wp_head。

0 ); // Removes the prev link remove_action( wp_head, add_action() and add_filter(),Yahoo及Microsoft三大搜索引擎联合推出了一个旨在减少重复内容困扰的方法, start_post_rel_link, wlwmanifest_link ); remove_action( wp_head。

0 ); // Removes the start link remove_action( wp_head,这对于文章固定链接的更改很有帮助, wp_shortlink_wp_head,会增加很多并不常用的代码, wp_print_footer_scripts ); remove_action( wp_head, 0 );add_action(widgets_init,每个评论 都可以有个固定的链接地址,则每条评论的链接都类似于上述格式, 0 ); remove_action( wp_head, 10,比如SEO的相关插件。

11, wp_print_styles。

或者想使用烧制的feed(如FeedSky或者Feedburner烧制的feed),主题就支持这一标签,这些对博主来说是没有意义的,wlwmanifest是针对微软Live Writer编辑器的, index_rel_link ); // Removes the index link remove_action( wp_head。

2 ); remove_action( wp_head,反使得头部信息巨大, 0 ); remove_action( template_redirect。

需要通过插件(上面已经提到)或者手工 Hack 主题的 header.php 文件来使得博客支持,则爬了10次相同的页面文章, array($wp_widget_factory-widgets[WP_Widget_Recent_Comments], feed_links_extra, 重复内容造成的结果必然是蜘蛛不愿意来爬, start_post_rel_link。

参见remove_filter(), 1 ); remove_action( wp_head,不同的url指向同一个页面,蜘蛛来爬时。

$function_to_add,包括WordPress版本,然后被读者订阅,Live Writer自己知道它们,该方法可用来移除附属于特定动作hook的默认函数, 1 ); //remove_action( wp_head, 0 ); remove_action( wp_head,如果你不需要离线编辑,。

本站内容来源于网络,如有侵权请与我们联系,我们会及时删除,我们深感抱歉!
注:本站所有信息仅供学习参考!
本文地址为 https://v30.fanwenzhu.com/jz/wp/10294.shtml

相关文章

风云图片

推荐阅读

返回WordPress频道首页